home *** CD-ROM | disk | FTP | other *** search
- #include "defs.h"
-
- /// "prototypes"
-
- Prototype BOOL InitC(void);
- Prototype void ExitC(void);
-
- ///
- /// "init"
-
- /* ----------------------------------- InitC -----------------------------------
-
- Library startup code (C entry point). Prepare arrays which will help us to
- quickly decide if a character is a white space character or a separator.
-
- */
-
- BOOL
- InitC(void)
- {
- UWORD ascii;
-
- InitSemaphore(&QuickInfoSemaphore);
-
- NewList(&DictionaryList);
-
- for (ascii = 0; ascii < 256; ++ascii) {
-
- if (((ascii >= '0') && (ascii <= '9')) || ((ascii >= '@') && (ascii <= 'Z')) || ((ascii >= 'a') && (ascii <= 'z')) || (ascii == '_') || ((ascii >= 'À') && (ascii <= 'ÿ'))) {
-
- IsSPC[ascii] = FALSE;
- }
- else if ((ascii == '{') || (ascii == '}') || (ascii == 92)) {
-
- // TeX specific handling of {} and \
-
- IsSPC[ascii] = FALSE;
- }
- else
- IsSPC[ascii] = TRUE;
-
- IsBOUNDARY[ascii] = (ascii == '(');
- }
-
- return(TRUE);
- }
-
- ///
- /// "exit"
-
- /* ----------------------------------- ExitC -----------------------------------
-
- Library cleanup code
-
- */
-
- __geta4 void
- ExitC(void)
- {
- // free dictionaries
-
- struct Dictionary *dictionary;
- struct Dictionary *next;
-
- for (dictionary = (struct Dictionary *)DictionaryList.lh_Head; next = (struct Dictionary *)dictionary->Node.ln_Succ; dictionary = next) {
-
- struct Template *entry, *nextentry;
-
- for (entry = (struct Template *)dictionary->Entries.lh_Head; nextentry = (struct Template *)entry->Node.ln_Succ; entry = nextentry) {
-
- Remove(&entry->Node);
-
- FreeVec(entry);
- }
-
- Remove(&dictionary->Node);
-
- FreeVec(dictionary->Data);
-
- FreeVec(dictionary);
- }
- }
-
- ///
-